<template>
  <div class="text-left padding-lr ">
    <el-row :gutter="10">
      <el-col :span="10">
        <el-card>
          <div slot="header" class="clearfix relative">
            <span class="title-icon">搜索分单</span>
            <!--查询按钮 点击查询 -->
            <el-button
              type="success"
              size="mini"
              class="header-save-btn"
              @click="searchOrder"
            >
              搜索
            </el-button>
          </div>
          <el-form size="mini" label-width="80px" :model="searchForm">
            <el-form-item label="运单状态">
              <el-select
                multiple
                v-model="searchForm.status"
                filterable
                clearable
                placeholder="请选择"
              >
                <el-option
                  v-for="(item, value) in initData.waybillStatusMap"
                  :key="value"
                  :label="m(item)"
                  :value="value"
                />
              </el-select>
            </el-form-item>
            <el-form-item label="派送地址">
              <el-select
                v-model="searchForm.dispatchAddressCode"
                filterable
                clearable
                placeholder="请选择"
              >
                <el-option
                  v-for="(item, value) in initData.shippingfbastockMap"
                  :key="value"
                  :label="value"
                  :value="item"
                />
              </el-select>
            </el-form-item>
            <el-form-item label="运单号">
              <el-input
                type="textarea"
                v-model="searchForm.waybillNos"
                clearable
              ></el-input>
            </el-form-item>
            <el-row :gutter="10">
              <el-col :span="12">
                <el-form-item label="主单号">
                  <el-input
                    type="textarea"
                    v-model="searchForm.masterNumbers"
                    clearable
                  ></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="柜号">
                  <el-input
                    type="textarea"
                    v-model="searchForm.contairNumbers"
                    clearable
                  ></el-input>
                </el-form-item>
              </el-col>
            </el-row>
          </el-form>
          <el-divider></el-divider>
          <el-table size="mini" :data="SearchData" style="width: 100%">
            <ex-table-column
              v-for="column in tableColumns"
              :key="column.prop"
              :auto-fit="true"
              :fit-header="true"
              :prop="column.prop"
              :label="column.label"
            />
            <ex-table-column :auto-fit="true" label="操作">
              <template slot-scope="scope">
                <i
                  class="el-icon-circle-plus pointer text-xl text-green"
                  @click="addPlanItem(scope)"
                ></i>
              </template>
            </ex-table-column>
          </el-table>
        </el-card>
      </el-col>
      <el-col :span="14">
        <el-card>
          <div slot="header" class="clearfix relative">
            <span class="title-icon">详细信息(装车计划)</span>
            <el-button-group class="header-save-btn">
              <el-button
                type="primary"
                size="mini"
                icon="el-icon-download"
                @click="exportZcOceanPodByPage"
              >海运POD
              </el-button>
              <el-button
                type="primary"
                size="mini"
                icon="el-icon-download"
                @click="exportZcPodByPage"
                >导出POD
              </el-button>
              <el-button
                type="success"
                size="mini"
                @click="submitForm('planFormRef')"
              >
                保存
              </el-button>
            </el-button-group>
          </div>

          <el-form
            ref="planFormRef"
            size="mini"
            label-width="80px"
            :rules="planFormRules"
            :model="planForm"
          >
            <el-row :gutter="10">
              <el-col :span="12">
                <el-form-item label="物流方法" prop="shippingFunction">
                  <el-select
                    v-model="planForm.shippingFunction"
                    filterable
                    clearable
                    placeholder="请选择"
                  >
                    <el-option
                      v-for="(item, value) in initData.shippingFunctionMap"
                      :key="value"
                      :label="item"
                      :value="value"
                    />
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="卡车公司" prop="truckCompany">
                  <el-input
                    v-model="planForm.truckCompany"
                    clearable
                  ></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="预约时间" prop="appointmentZcTime">
                  <el-date-picker
                    v-model="planForm.appointmentZcTime"
                    type="datetime"
                    placeholder="选择日期时间"
                    value-format="yyyy-MM-dd HH:mm:ss"
                  >
                  </el-date-picker>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="预约号码" prop="appointmentZcNumber">
                  <el-input
                    v-model="planForm.appointmentZcNumber"
                    clearable
                  ></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="装车时间" prop="truckLoadingDate">
                  <el-date-picker
                    v-model="planForm.truckLoadingDate"
                    type="datetime"
                    value-format="yyyy-MM-dd HH:mm:ss"
                    placeholder="选择日期时间"
                  >
                  </el-date-picker>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="转运时间">
                  <el-date-picker
                    v-model="planForm.dispatchTime"
                    type="datetime"
                    value-format="yyyy-MM-dd HH:mm:ss"
                    placeholder="选择日期时间"
                  >
                  </el-date-picker>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="签收时间">
                  <el-date-picker
                    v-model="planForm.signTime"
                    type="datetime"
                    value-format="yyyy-MM-dd HH:mm:ss"
                    placeholder="选择日期时间"
                  >
                  </el-date-picker>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="总托盘数" prop="trayNumber">
                  <el-input-number
                    size="mini"
                    clearable
                    v-model="planForm.trayNumber"
                  ></el-input-number>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="目的国家" prop="countryId">
                  <el-select
                    v-model="planForm.countryId"
                    filterable
                    clearable
                    placeholder="请选择"
                    @change="retrieveAddress"
                  >
                    <el-option
                      v-for="(item, value) in initData.countryMap"
                      :key="value"
                      :label="item"
                      :value="parseInt(value)"
                    />
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <!--                修改了之前的是否fba-->
                <!--                <el-form-item label="是否FBA" prop="isFba">-->
                <!--                  <el-select-->
                <!--                    v-model="planForm.isFba"-->
                <!--                    filterable-->
                <!--                    clearable-->
                <!--                    placeholder="请选择"-->
                <!--                  >-->
                <!--                    <el-option-->
                <!--                      v-for="(item, value) in initData.isfbaMap"-->
                <!--                      :key="value"-->
                <!--                      :label="item"-->
                <!--                      :value="parseInt(value)"-->
                <!--                    />-->
                <!--                  </el-select>-->
                <!--                </el-form-item>-->
                <el-form-item label="仓库类型" prop="purposeWarehouseType">
                  <el-radio-group
                    v-model="planForm.purposeWarehouseType"
                    @change="retrieveAddress"
                  >
                    <el-radio
                      v-for="(item, value) in initData.stockTypeMap"
                      :key="value"
                      :label="parseInt(value)"
                    >
                      {{ item }}
                    </el-radio>
                  </el-radio-group>
                </el-form-item>
              </el-col>
              <!--              判断-->
              <!--              <el-col :span="12" v-if="planForm.isFba === 1">-->
              <el-col :span="12" v-if="planForm.purposeWarehouseType !== 700">
                <el-form-item label="派送地址" prop="dispatchAddressCode">
                  <el-select
                    v-model="planForm.dispatchAddressCode"
                    filterable
                    clearable
                    placeholder="请选择"
                  >
                    <el-option
                      v-for="(item, value) in queryShippingfbaStocklist"
                      :key="value"
                      :label="value"
                      :value="item"
                    />
                  </el-select>
                </el-form-item>
              </el-col>
              <!--判断是否fba来决定是不是要填写信息-->
              <div v-if="planForm.purposeWarehouseType === 700">
                <el-col :span="12">
                  <el-form-item label="公司/个人" prop="dispatcher">
                    <el-input
                      type="text"
                      v-model="planForm.dispatcher"
                      clearable
                    ></el-input>
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="联系人" prop="dispatchLinkMan">
                    <el-input
                      type="text"
                      v-model="planForm.dispatchLinkMan"
                      clearable
                    ></el-input>
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="联系电话" prop="dispatchPhone">
                    <el-input
                      type="text"
                      v-model="planForm.dispatchPhone"
                      clearable
                    ></el-input>
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="州/省" prop="dispatchProvince">
                    <el-input
                      type="text"
                      v-model="planForm.dispatchProvince"
                      clearable
                    ></el-input>
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="城市" prop="dispatchCity">
                    <el-input
                      type="text"
                      v-model="planForm.dispatchCity"
                      clearable
                    ></el-input>
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="邮编" prop="dispatchZipCode">
                    <el-input
                      type="text"
                      v-model="planForm.dispatchZipCode"
                      clearable
                    ></el-input>
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="派送地址" prop="dispatchAddress">
                    <el-input
                      type="text"
                      v-model="planForm.dispatchAddress"
                      clearable
                    ></el-input>
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="派送地址2" prop="dispatchAddress2">
                    <el-input
                      type="text"
                      v-model="planForm.dispatchAddress2"
                      clearable
                    ></el-input>
                  </el-form-item>
                </el-col>
              </div>
              <el-col :span="12">
                <el-form-item label="备注">
                  <el-input
                    v-model="planForm.customerRemark"
                    clearable
                  ></el-input>
                </el-form-item>
              </el-col>
            </el-row>
          </el-form>
          <el-divider></el-divider>
          <el-table
            size="mini"
            :data="planData"
            style="width: 100%"
            show-summary
          >
            <!--待加入装车计划的表单-->
            <el-table-column
              :auto-fit="true"
              label="运单号"
              prop="waybillNo"
            ></el-table-column>
            <el-table-column
              :auto-fit="true"
              label="参考号"
              prop="referenceNo"
            ></el-table-column>
            <el-table-column
              :auto-fit="true"
              label="主单号"
              prop="masterNumber"
            ></el-table-column>
            <el-table-column
              :auto-fit="true"
              label="实重"
              prop="inStockActualWeight"
            ></el-table-column>
            <el-table-column
              :auto-fit="true"
              label="体积"
              prop="inStockVolume"
            ></el-table-column>
            <el-table-column
              :auto-fit="true"
              label="件数"
              prop="inStockTotalPackages"
            ></el-table-column>
            <el-table-column
              v-if="isSea"
              :auto-fit="true"
              label="拆托号"
              prop="disContainerNo"
            ></el-table-column>
            <el-table-column
              :auto-fit="true"
              v-if="isSea"
              label="托盘数"
              prop="seaTrayNumber"
            ></el-table-column>

            <el-table-column
              :auto-fit="true"
              label="备注"
              prop="customerRemark"
            >
              <template slot-scope="scope">
                <el-input size="mini" v-model="scope.row['customerRemark']" />
              </template>
            </el-table-column>
            <el-table-column :auto-fit="true" label="操作">
              <template slot-scope="scope">
                <i
                  class="el-icon-remove pointer text-xl text-red"
                  @click="delPlanItem(scope)"
                ></i>
              </template>
            </el-table-column>
          </el-table>
        </el-card>
      </el-col>
    </el-row>
  </div>
</template>

<script>
//引入 ajax 工具
import { ajax } from "@/store/yg/common/utils";
import { closeDialog } from "@/utils";
//翻译工具
import { m } from "@/store/yg/common/local";
//全局文件 配置
import * as constant from "@/store/yg/common/constant";

export default {
  props: ["row", "data"],
  data() {
    return {
      // initData 返回的 对象 初始化的对象
      initData: {},
      //筛选的 仓库地址
      /**
         100: "FBA"
         200: "天际仓"
         */
      shippingFunction: "",
      isSea: false,
      queryShippingfbaStocklist: {},
      //等待加入装车计划的数据
      planData: [],
      //点击查询按钮 后 这个里面的数据
      SearchData: [],
      //删除的id
      delSeaAirWaybillMiddleIds: [],
      //
      //创建装车计划的数据
      planForm: {
        id: "",
        truckCompany: "",
        appointmentZcTime: "",
        appointmentZcNumber: "",
        truckLoadingDate: "",
        dispatchTime: "",
        signTime: "",
        trayNumber: "",
        isFba: "",
        purposeWarehouseType: "",
        countryId: "",
        dispatchAddressCode: "",
        customerRemark: ""
      },
      //查询的订单参数
      searchForm: {},
      shippingAddress: {},

      tableColumns: [
        {
          prop: "waybillNo",
          label: "运单号"
        },
        {
          prop: "referenceNo",
          label: "参考号"
        },
        {
          prop: "masterNumber",
          label: "主单号"
        },
        {
          prop: "inStockActualWeight",
          label: "实重"
        },
        {
          prop: "inStockVolume",
          label: "体积"
        },
        {
          prop: "inStockTotalPackages",
          label: "件数"
        }
      ],
      tableColumnSeas: [
        {
          prop: "waybillNo",
          label: "运单号"
        },
        {
          prop: "referenceNo",
          label: "参考号"
        },
        {
          prop: "masterNumber",
          label: "主单号"
        },
        {
          prop: "inStockActualWeight",
          label: "实重"
        },
        {
          prop: "inStockVolume",
          label: "体积"
        },
        {
          prop: "inStockTotalPackages",
          label: "件数"
        },
        {
          prop: "disContainerNo",
          label: "拆托号"
        },
        {
          prop: "seaTrayNumber",
          label: "托盘数"
        }
      ],
      //表单验证的格式和提示信息
      planFormRules: {
        truckCompany: [{ required: true, message: "请输入", trigger: "blur" }],
        appointmentZcNumber: [
          { required: true, message: "请输入", trigger: "blur" }
        ],
        trayNumber: [{ required: true, message: "请输入", trigger: "blur" }],
        appointmentZcTime: [
          { required: true, message: "请选择", trigger: "change" }
        ],

        truckLoadingDate: [
          { required: true, message: "请选择", trigger: "change" }
        ],
        countryId: [
          { required: true, message: "请选择目的国家", trigger: "change" }
        ],
        dispatchAddressCode: [
          { required: true, message: "请选择派送地址", trigger: "change" }
        ],
        dispatcher: [{ required: true, message: "请输入", trigger: "blur" }],
        dispatchLinkMan: [
          { required: true, message: "请输入", trigger: "blur" }
        ],
        dispatchPhone: [{ required: true, message: "请输入", trigger: "blur" }],
        dispatchProvince: [
          { required: true, message: "请输入", trigger: "blur" }
        ],
        dispatchCity: [{ required: true, message: "请输入", trigger: "blur" }],
        dispatchZipCode: [
          { required: true, message: "请输入", trigger: "blur" }
        ],
        dispatchAddress: [
          { required: true, message: "请输入", trigger: "blur" }
        ],
        purposeWarehouseType: [
          { required: true, message: "请选择仓库类型", trigger: "change" }
        ]
      }
    };
  },
  //生命周期函数  页面渲染完成
  mounted() {
    //调用初始化数据方法 渲染 下列数据 等其他数据
    const entryUri = this.$store.state.edit.entry.entryUri;
    console.log(entryUri);
    //空运
    if (entryUri.indexOf("airedit") != -1) {
      this.shippingFunction = "AT";
    } else {
      this.shippingFunction = "ST";
      this.isSea = true;
      this.tableColumns = this.tableColumnSeas;
    }
    console.log(this.shippingFunction);
    this.planForm.shippingFunction = this.shippingFunction;
    this.init();
    //点编辑请求接口
    if (this.$store.state.edit.id) {
      this.editData();
      //加载地址信息
    }
  },
  methods: {
    opened() {
      if (this.$store.state.edit.id) {
        return;
      }
      this.planData = [];
      this.planForm = {
        id: "",
        truckCompany: "",
        appointmentZcTime: "",
        appointmentZcNumber: "",
        truckLoadingDate: "",
        dispatchTime: "",
        signTime: "",
        trayNumber: "",
        isFba: "",
        purposeWarehouseType: "",
        countryId: "",
        dispatchAddressCode: "",
        customerRemark: ""
      };
    },
    //调用请求 初始化数据的方法 initSeaAirWaybillMiddleData
    async init() {
      // {code, data, message} 解构赋值 获取返回的 代码 和 数据 和 提示信息  initSeaAirWaybillMiddleData 是请求的url
      const { code, data, message } = await ajax(
        "initSeaAirWaybillMiddleData",
        {}
      );
      // 不等于 200 都是错的
      if (code !== 200) {
        //框架错误提示信息
        if (message) {
          this.$message.error(message);
        } else {
          this.$message.error("服务器异常");
        }
        return;
      }
      //获取到返回的data数据对象 赋值给 initData
      this.initData = data;
      this.planForm.shippingFunction = this.shippingFunction;
    },
    //点击查询 请求 接口 查询需要参与装车计划的订单 querySeaAirWaybillbyKey 同步的方法
    async searchOrder() {
      const { code, data, message } = await ajax(
        "querySeaAirWaybillbyKey",
        this.searchForm
      );
      if (code !== 200) {
        //框架错误提示信息
        if (message) {
          this.$message.error(message);
        } else {
          this.$message.error("服务器异常");
        }
        return;
      }
      //查询到的数据  直接赋值给 SearchData
      this.SearchData = data;
    },
    //解析 翻译的 下拉数据英文对应的中文 需要接收一个参数
    m(params) {
      return m(params);
    },
    //点击保存一个装车计划 createSeaAirWaybillMiddle
    async saveInfo() {
      //获取需要参加装车计划的订单id
      const createSeaAirWaybillMiddleDetailDTOS = [];
      console.log("this.planData", this.planData);
      for (const i of this.planData) {
        const everyDetail = {};
        //合单 id
        everyDetail.id = i.seaAirWaybillMiddleId;
        everyDetail.singleWaybillId = i.id;
        everyDetail.waybillNo = i.waybillNo;
        createSeaAirWaybillMiddleDetailDTOS.push(everyDetail);
      }
      //放入 planForm 中
      this.planForm.createSeaAirWaybillMiddleDetailDTOS = createSeaAirWaybillMiddleDetailDTOS;
      this.planForm.delSeaAirWaybillMiddleIds = this.delSeaAirWaybillMiddleIds;
      if (!this.planForm.shippingFunction) {
        this.$message.error("请选择物流方式");
      }
      const { code, data, message } = await ajax(
        "createSeaAirWaybillMiddle",
        this.planForm
      );
      if (code !== 200) {
        //框架错误提示信息
        if (message) {
          this.$message.error(message);
        } else {
          this.$message.error("服务器异常");
        }
      } else {
        this.$message.success("成功");
        closeDialog();
      }
    },
    //点击添加 把左边的数据 放到右边
    addPlanItem(scope) {
      console.log("scope :>> ", scope);
      if (this.planData) {
        this.planData.forEach(data => {
          if (data["id"] === scope.row["id"]) {
            this.$message.error("不允许重复添加单号" + data["waybillNo"]);
            this.SearchData.splice(scope.$index, 1);
            throw new Error("重复添加单号");
          }
        });
      }
      this.planData.push(scope.row);
      this.SearchData.splice(scope.$index, 1);
      this.delSeaAirWaybillMiddleIds.splice(scope.$index, 1);
      console.log(
        "this.delSeaAirWaybillMiddleIds",
        this.delSeaAirWaybillMiddleIds
      );
    },
    delPlanItem(scope) {
      this.planData.splice(scope.$index, 1);
      this.SearchData.push(scope.row);
      this.delSeaAirWaybillMiddleIds.push(scope.row.seaAirWaybillMiddleId);
      console.log(
        "this.delSeaAirWaybillMiddleIds",
        this.delSeaAirWaybillMiddleIds
      );
    },
    getSummaries(param) {
      const { columns, data } = param;
      const sums = [];
      columns.forEach((column, index) => {
        if (index === 0) {
          sums[index] = "总计";
          return;
        }
        const values = data.map(item => Number(item[column.property]));
        if (!values.every(value => isNaN(value))) {
          sums[index] = values.reduce((prev, curr) => {
            const value = Number(curr);
            if (!isNaN(value)) {
              return prev + curr;
            } else {
              return prev;
            }
          }, 0);
          sums[index] += " 元";
        } else {
          sums[index] = "N/A";
        }
      });
      return sums;
    },
    // 编辑页面
    async editData() {
      // {code, data, message} 解构赋值 获取返回的 代码 和 数据 和 提示信息  initSeaAirWaybillMiddleData 是请求的url
      const { code, data, message } = await ajax("queryPlanById", {
        id: this.$store.state.edit.id
      });
      // 不等于 200 都是错的
      if (code !== 200) {
        //框架错误提示信息
        if (message) {
          this.$message.error(message);
        } else {
          this.$message.error("服务器异常");
        }
      } else {
        //吧数据填写进去 放入这个里面
        this.planForm = data.seaAirWaybillLoadPlan;
        //放入已经查询的数据列表
        this.planData = data.seaAirWaybillLoadPlans;
        //兼容 一下数据 如果 是老系统的数据 是 fba 的 仓库类型就是fba 否则就是其他
        // if (this.planForm.isFba === 1) {
        //   this.planForm.purposeWarehouseType = 100;
        // } else {
        //   this.planForm.purposeWarehouseType = 700;
        // }
        //加载数据
        this.retrieveAddress();
      }
    },
    //校验数据的方法
    submitForm(formName) {
      this.$refs[formName].validate(valid => {
        if (valid) {
          this.saveInfo();
        } else {
          console.log("error submit!!");
          return false;
        }
      });
    },
    async exportZcOceanPodByPage(){
      //获取需要参加装车计划的订单id
      const createSeaAirWaybillMiddleDetailDTOS = [];
      for (const i of this.planData) {
        const everyDetail = {};
        everyDetail.id = i.seaAirWaybillMiddleId;
        everyDetail.singleWaybillId = i.id;
        createSeaAirWaybillMiddleDetailDTOS.push(everyDetail);
      }
      //放入 planForm 中
      this.planForm.createSeaAirWaybillMiddleDetailDTOS = createSeaAirWaybillMiddleDetailDTOS;
      const { code, data, data2, message } = await ajax(
        "exportZcOceanPodByPage",
        this.planForm
      );
      if (code !== 200) {
        //框架错误提示信息
        if (message) {
          this.$message.error(message);
        } else {
          this.$message.error("服务器异常");
        }
      } else {
        //文件下载url
        var path = constant.FILE_SERVER + data;
        location.href =
          constant.API_SERVER +
          "/open/downloadFileByHttp?fileName=" +
          data2 +
          "&path=" +
          path +
          data2;
        this.$message.success("成功");
      }
    },
    //导出pod
    async exportZcPodByPage() {
      //获取需要参加装车计划的订单id
      const createSeaAirWaybillMiddleDetailDTOS = [];
      for (const i of this.planData) {
        const everyDetail = {};
        everyDetail.id = i.seaAirWaybillMiddleId;
        everyDetail.singleWaybillId = i.id;
        createSeaAirWaybillMiddleDetailDTOS.push(everyDetail);
      }
      //放入 planForm 中
      this.planForm.createSeaAirWaybillMiddleDetailDTOS = createSeaAirWaybillMiddleDetailDTOS;
      const { code, data, data2, message } = await ajax(
        "exportZcPodByPage",
        this.planForm
      );
      if (code !== 200) {
        //框架错误提示信息
        if (message) {
          this.$message.error(message);
        } else {
          this.$message.error("服务器异常");
        }
      } else {
        //文件下载url
        var path = constant.FILE_SERVER + data;
        location.href =
          constant.API_SERVER +
          "/open/downloadFileByHttp?fileName=" +
          data2 +
          "&path=" +
          path +
          data2;
        this.$message.success("成功");
      }
    },
    //  根据国家 跟 仓库 匹配 地址
    async retrieveAddress() {
      // 已经查询出来所有的了  不需要再去查询了
      // planForm.dispatchAddressCode = this.this.initData.shippingfbastockMap;
      //获取选择的国家 和 仓库类型
      const countryId = this.planForm.countryId;
      const purposeWarehouseType = this.planForm.purposeWarehouseType;
      if (
        null == countryId ||
        null == purposeWarehouseType ||
        "" == countryId ||
        "" == purposeWarehouseType
      ) {
        return;
      }
      ajax("queryShippingfbaStockByCoutryType", {
        param1: countryId,
        param2: purposeWarehouseType
      }).then(
        res => {
          if (200 === res.code) {
            this.queryShippingfbaStocklist = res.data;
          } else {
            if (null != res.message) {
              this.$message.error(m(res.message));
            } else {
              this.$message.error("获取匹配仓库失败");
            }
          }
        },
        error => {
          console.log(error);
          this.$message.error("获取匹配仓库异常");
        }
      );
    }
  }
};
</script>

<style scoped>
/deep/ .el-select,
.el-input-number,
.el-date-editor {
  width: 100%;
}
</style>
